Skip to content

Conversation

@marcodejongh
Copy link
Owner

Summary

This PR improves Sentry error tracking configuration to ensure errors are only reported from production environments, preventing noise from local development and preview deployments.

Changes

  • instrumentation-client.ts: Changed hostname check from includes("boardsesh.com") to exact match === "boardsesh.com" to prevent false positives from subdomains
  • sentry.edge.config.ts: Added NODE_ENV === "production" check alongside VERCEL_ENV === "production" to ensure both conditions are met before initializing Sentry
  • sentry.server.config.ts: Added NODE_ENV === "production" check alongside VERCEL_ENV === "production" to ensure both conditions are met before initializing Sentry

Implementation Details

The changes enforce stricter production environment detection across all three Sentry configuration entry points:

  • Client-side now uses exact hostname matching instead of substring matching
  • Server-side and edge configurations now require both NODE_ENV and VERCEL_ENV to be set to "production", providing defense-in-depth against accidental error reporting from non-production environments

This prevents error pollution in Sentry from localhost development, preview deployments, and other non-production environments.

https://claude.ai/code/session_013jBTzFjbJQFyfsDM5pT4t1

- Add NODE_ENV check to server and edge configs to ensure Sentry is
  only enabled when both NODE_ENV and VERCEL_ENV are "production"
- Change client hostname check from includes() to exact match to
  prevent errors from subdomains or similar domains

https://claude.ai/code/session_013jBTzFjbJQFyfsDM5pT4t1
@vercel
Copy link

vercel bot commented Feb 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
boardsesh Building Building Feb 1, 2026 10:37pm

Request Review

@claude
Copy link

claude bot commented Feb 1, 2026

Claude Review

Ready to merge - No significant issues found.

The changes correctly tighten Sentry initialization to production-only by:

  • Using exact hostname match instead of substring matching (client)
  • Requiring both NODE_ENV and VERCEL_ENV to be "production" (server/edge)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants